package com.freshfresh.activity.selfcenter;


import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.freshfresh.activity.BaseActivity;
import com.freshfresh.activity.R;

public class SetInfoActivity extends BaseActivity {

	
	private ImageButton leftButton=null;
	private WebView webView=null;
	private RelativeLayout rel_back=null;
	private TextView tv_title=null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ser_introduce);
		initView();
		
		
		
		rel_back.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				SetInfoActivity.this.finish();
			}
		});
		if(isNetLink()){
			WebSettings webSettings = webView.getSettings();  
	        //设置WebView属性，能够执行Javascript脚本    
	        webSettings.setJavaScriptEnabled(true);    
	        //设置可以访问文件  
	        webSettings.setAllowFileAccess(true);  
	         //设置支持缩放  
	        webSettings.setBuiltInZoomControls(true);  
	        //加载需要显示的网页    
	        webView.loadUrl(getIntent().getExtras().getString("url"));    
	        //设置Web视图    
	        
		}else{
		}

	}
	
	
	public void initView(){
		tv_title=(TextView)findViewById(R.id.tv_title);
		
		rel_back=(RelativeLayout)findViewById(R.id.rel_back);
		tv_title.setText(getIntent().getExtras().getString("title"));
		webView=(WebView)findViewById(R.id.webView);
	}
	
	// 判断当前的网络状态
				public boolean isNetLink() {
					// 连网管理
					ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
					// 网络工作信息
					NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
					if (networkInfo == null || !networkInfo.isAvailable()) { // 当前无可用网络
						Toast.makeText(getApplicationContext(), "当前无可用网络", 1).show();
						return false;
					} else { // 当前有可用网络
						return true;
					}
				}

}
